import request from './request.js'

let BASEURL = '/api'
// 搜索店铺信息
export const getSearchList = (geohash, keyword) => request(`${BASEURL}/search_shops`, {
  geohash, keyword
})

// 用户名密码登陆
export const getLoginPwd = ({
  name,
  pwd,
  captcha
}) => request(`${BASEURL}/login_pwd`, {
  name,
  pwd,
  captcha
},
'POST')
// 发送短信验证码
export const getSendCode = (phone) => request(`${BASEURL}/sendcode`, {
  phone
})
// 手机号验证码登陆
export const getSms = ({
  phone,
  code
}) => request(`${BASEURL}/login_sms`, {
  phone,
  code
}, 'POST')
// 获取用户信息
export const getUserInfo = () => request(`${BASEURL}/userinfo`)

// 退出
export const getLogout = () => request(`${BASEURL}/logout`)

// 获取地址
export const getPosition = (geohash) => request(`${BASEURL}/position/${geohash}`)

// 获取食品分类列表
export const getCategory = () => request(`${BASEURL}/index_category`)

// 根据经纬度获取商铺列表
export const getShops = (latitude, longitude) => request(`${BASEURL}//shops`, {
  latitude, longitude
})
